<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //声明一个函数
    function fn(t){
      let state = t;

      let setState = (v) => {
        state = v;
      }

      return [state, setState]
    }

    let [count, setCount] = fn(100);

    //更新状态值
    setCount(101);

    console.log(count, setCount);



  </script>
</body>
</html>